with open('文献input.txt', 'r', encoding='utf-8') as file1:
    # 读取所有行
    lines = file1.readlines()

def process_per_line(line):
    line=line.replace('arXiv preprint arXiv:',' https://arxiv.org/abs/')
    return line
lines=[process_per_line(_)  for _ in lines ]

# 对行进行排序
sorted_lines = sorted(lines)

# 将排序后的行写入文件2.txt
with open('文献sorted.txt', 'w', encoding='utf-8') as file2:
    file2.writelines(sorted_lines)

print("处理完成，结果保存在2.txt中。")
